package cn.wk.util;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import java.util.List;

public class ConvertUtil {

    public ConvertUtil() {
        super();
    }
    public static  String ConvertToJson(List<?>list){
        JSONArray jsonArray=JSONArray.fromObject(list);
        String s = jsonArray.toString();
        return s;

    }
    public static  String ConvertPageJson(List<?>list,int count){
        JSONObject jsonObject=new JSONObject();
        jsonObject.put("code",0);
        jsonObject.put("msg","");
        jsonObject.put("count",count);
        JSONArray jsonArray=JSONArray.fromObject(list);
        String s = jsonArray.toString();
        jsonObject.put("data",s);
        return jsonObject.toString();

    }
}
